/**
* @uses lib/Prototype/Prototype.js
* @uses lib/Company/Company.js
* @uses lib/Company/Utilities/Utils.js
* @uses lib/Company/Plugins/Plugins.js
* @uses lib/Company/Plugins/Detector.js
* @uses lib/Company/Error/ErrorHandler.js
*/

/**
* @namespace This namespace contains classes for standard user interface elements.
* @author erik 12/30/2007
*/


Company.UI = {};


 /**
 * Embeds a flash object in the page. Replaces InsertFlash() from ClientCommon.js
 * @param {String} imgID The unique ID of the Flash object element
 * @param {Number} imgW The width of the Flash element
 * @param {Number} imgH The height of the Flash element
 * @param {String} flashPath The path to the Flash file, usually on the cdn
 * @param {String} flashURL Imports "sUrl" as a root level variable to the movie which the movie can use to link to when clicked 
 * @param {String} staticURL Static image display if flash is not installed
 * @param {Boolean} isIFrame True if the movie is being loaded in an IFRAME
 * @example Company.UI.InsertFlash("HomeBanner-FlashTest-Img01", 460, 180, 
 * 	"http://published.Company.com/ads/Articles/HomeBanner/HomeBanner-FlashTest-Img04.swf", 
 * 	"StudioList.asp?Studio=Matt+Sterling", 
 * 	"http://published.Company.com/ads/Articles/HomeBanner/HomeBanner-FlashTest-Img03.jpg");
 * 	//<A href=http://alpha.Company.com/work/ClientSamples/InsertFlash.htm target=_blank>sample code</A>
 * @author Nestor 1/1/2004
 */
Company.UI.InsertFlash = function(imgID, imgW, imgH, flashPath, flashURL, staticURL, isIFrame){

	var target = " target=_blank";
		
	if (Company.Plugins.Detector.isRequiredFlashInstalled()) {
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ');
		document.write(' ID="' + imgID + '" WIDTH="' + imgW + '" HEIGHT="' + imgH + '" ALIGN="">');
		document.write(' <PARAM NAME=movie VALUE="' + flashPath + '"> ');
		document.write(' <PARAM NAME="AllowScriptAccess" VALUE="always"> ');
		document.write(' <PARAM NAME="wmode" VALUE="opaque"> ');
			
		if (flashURL){
			document.write('<PARAM Name=FlashVars VALUE="sUrl=' + flashURL.replace('&','%26') + '">');
		}
		document.write('<PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000> <PARAM NAME="loop" value="true">  ');	
		document.write('<EMBED FlashVars="sUrl=' + flashURL + '" src="' + flashPath + '" quality=high bgcolor=#000000  ');
		document.write(' swLiveConnect=FALSE WIDTH="' + imgW + '" HEIGHT="' + imgH + '" NAME="' + imgID + '" ALIGN=""');
		document.write(' wmode="opaque" AllowScriptAccess="always" ');
		document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
		document.write(' </EMBED>');
		document.write('</OBJECT>');
	} else {
		image = '<IMG SRC="' + staticURL + '" WIDTH="' + imgW + '" HEIGHT="' + imgH + '" BORDER=0>';
		if (flashURL){
			document.write('<a href=' + flashURL + ' ' + target + '>' + image + '</a>');
		} else {
			document.write(image);
		}
	}

}